package org.anyin.gitee.cloud.lib.permission;

import com.google.common.collect.Lists;
import org.anyin.gitee.cloud.lib.core.cache.CacheTemplate;

import java.util.List;

public class DefaultPermissionRoleServiceImpl implements PermissionRoleService {

    private final CacheTemplate cacheTemplate;

    public DefaultPermissionRoleServiceImpl(CacheTemplate cacheTemplate) {
        this.cacheTemplate = cacheTemplate;
    }

    @Override
    public List<String> getPermissionByLoginId(String loginId) {
        return Lists.newArrayList();
    }

    @Override
    public List<String> getRoleByLoginId(String loginId) {
        return Lists.newArrayList();
    }

    @Override
    public void clear(String loginId) {
        cacheTemplate.keyRemove(Lists.newArrayList(
                PermissionRedisConstant.DEFAULT_USER_PERMISSION_PREFIX + loginId,
                PermissionRedisConstant.DEFAULT_USER_ROLE_PREFIX + loginId
        ));
    }
}
